styleproperty: Make this an object
authorBenjamin Otte <otte@redhat.com>
Sat, 31 Dec 2011 02:54:17 +0000 (03:54 +0100)
committerBenjamin Otte <otte@redhat.com>
Mon, 9 Jan 2012 17:37:51 +0000 (18:37 +0100)
gtk/gtkstyleproperty.c
gtk/gtkstylepropertyprivate.h

index fb1ca2496c35a7fc9c9b75724f821c68e3ae6a80..0f70738ee8f7912c353d5e767b2e86d15d52e174 100644 (file)
@@ -55,6 +55,31 @@ static GHashTable *print_funcs = NULL;
 static GHashTable *properties = NULL;
 static GPtrArray *__style_property_array = NULL;
 
+G_DEFINE_TYPE (GtkStyleProperty, _gtk_style_property, G_TYPE_OBJECT)
+
+static void
+gtk_style_property_finalize (GObject *object)
+{
+  GtkStyleProperty *property = GTK_STYLE_PROPERTY (object);
+
+  g_warning ("finalizing %s `%s', how could this happen?", G_OBJECT_TYPE_NAME (object), property->pspec->name);
+
+  G_OBJECT_CLASS (_gtk_style_property_parent_class)->finalize (object);
+}
+
+static void
+_gtk_style_property_class_init (GtkStylePropertyClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->finalize = gtk_style_property_finalize;
+}
+
+static void
+_gtk_style_property_init (GtkStyleProperty *property)
+{
+}
+
 static void
 register_conversion_function (GType             type,
                               GtkStyleParseFunc parse,
@@ -3228,7 +3253,7 @@ _gtk_style_property_register (GParamSpec               *pspec,
       return;
     }
 
-  node = g_slice_new0 (GtkStyleProperty);
+  node = g_object_new (GTK_TYPE_STYLE_PROPERTY, NULL);
   node->flags = flags;
   node->pspec = pspec;
   node->property_parse_func = property_parse_func;
index 4f5902ab929904783bcc8c87949c9f5b3fd8730d..263cc9f79bf1a1bc54cd424d816c3a3a747cc6e8 100644 (file)
 
 G_BEGIN_DECLS
 
-typedef struct _GtkStyleProperty GtkStyleProperty;
+#define GTK_TYPE_STYLE_PROPERTY           (_gtk_style_property_get_type ())
+#define GTK_STYLE_PROPERTY(obj)           (G_TYPE_CHECK_INSTANCE_CAST (obj, GTK_TYPE_STYLE_PROPERTY, GtkStyleProperty))
+#define GTK_STYLE_PROPERTY_CLASS(cls)     (G_TYPE_CHECK_CLASS_CAST (cls, GTK_TYPE_STYLE_PROPERTY, GtkStylePropertyClass))
+#define GTK_IS_STYLE_PROPERTY(obj)        (G_TYPE_CHECK_INSTANCE_TYPE (obj, GTK_TYPE_STYLE_PROPERTY))
+#define GTK_IS_STYLE_PROPERTY_CLASS(obj)  (G_TYPE_CHECK_CLASS_TYPE (obj, GTK_TYPE_STYLE_PROPERTY))
+#define GTK_STYLE_PROPERTY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_STYLE_PROPERTY, GtkStylePropertyClass))
+
+typedef struct _GtkStyleProperty           GtkStyleProperty;
+typedef struct _GtkStylePropertyClass      GtkStylePropertyClass;
+
 typedef enum {
   GTK_STYLE_PROPERTY_INHERIT = (1 << 0)
 } GtkStylePropertyFlags;
@@ -44,9 +53,10 @@ typedef void             (* GtkStylePrintFunc)             (const GValue
 typedef void             (* GtkStyleUnsetFunc)             (GtkStyleProperties     *props,
                                                             GtkStateFlags           state);
 
-
 struct _GtkStyleProperty
 {
+  GObject parent;
+
   GParamSpec               *pspec;
   GtkStylePropertyFlags     flags;
   guint                     id;
@@ -60,6 +70,13 @@ struct _GtkStyleProperty
   GtkStyleUnsetFunc         unset_func;
 };
 
+struct _GtkStylePropertyClass
+{
+  GObjectClass  parent_class;
+};
+
+GType               _gtk_style_property_get_type             (void) G_GNUC_CONST;
+
 guint                    _gtk_style_property_get_count     (void);
 const GtkStyleProperty * _gtk_style_property_get           (guint                   id);